package com.aat.dizena.base.service.impl;

import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aat.dizena.base.bean.Ress;
import com.aat.dizena.base.dao.RessDao;
import com.aat.dizena.base.service.RessService;

@Service
public class RessServiceImpl  implements RessService {

    @Autowired
    private RessDao ressDao;

    public int addBean(Ress bean){
        return ressDao.addBean(bean);
    }

    public int updateBean(Ress bean){
        return ressDao.updateBean(bean);
    }

    public int deleteBean(String id){
        return ressDao.deleteBean(id);
    }

    public Ress queryBean(String id){
        return ressDao.queryBean(id);
    }

    public List<Ress> queryAll(Map<String, Object> map){
        return ressDao.queryAll(map);
    }

    public long queryCount(Map<String, Object> map){
        return ressDao.queryCount(map);
    }

    //查询菜单结构
	public List<Ress> queryResByLP(String pid, Integer level) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("resPid", pid);
		map.put("resLevel", level);
		map.put("resType", "1");
		map.put("locked", "0");
		map.put("sortFiled", "resSort");
		map.put("direction", "ASC");
		return ressDao.queryAll(map);
	}

	public Integer queryResSort(String resType, Integer resLevel, String resPid) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("resPid", resPid);
		map.put("resLevel", resLevel);
		map.put("resType", resType);
		return ressDao.queryResSort(map);
	}

	public List<Ress> queryParentRes(String resType, Integer resLevel) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("resType", resType);
		map.put("resLevel", resLevel);
		return ressDao.queryParentRes(map);
	}

}
